package adapters;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import fragments.FirstFragment;
import fragments.SecondFragment;
import fragments.ThirdFragment;

/**
 * Created by pc on 2017/2/24.
 */

public class MyViewPagerAdapter extends FragmentPagerAdapter {

    List<Fragment> list = new ArrayList<Fragment>();

    public MyViewPagerAdapter(FragmentManager fm) {
        super(fm);
        list.add(new FirstFragment());
        list.add(new SecondFragment());
        list.add(new ThirdFragment());
    }

    @Override
    public Fragment getItem(int position) {
        return list.get(position);
    }

    @Override
    public int getCount() {
        return list.size();
    }
}
